﻿@{      
    string status = String.Empty;
    if(JDM.HasFlags(Model.Flags, "Canceled"))
    {
        status = "Canceled";
    }
    else if(JDM.HasFlags(Model.Flags, "Pending"))
    {
        status = "Pending";
    }
    else if(JDM.HasFlags(Model.Flags, "Confirmed"))
    {
        status = "Confirmed";
    }
    else if(JDM.HasFlags(Model.Flags, "Processing"))
    {
        status = "Processing";
    }
    else if(JDM.HasFlags(Model.Flags, "Completed"))
    {
        status = "Completed";
    }
}

<div class="box unit-overview order">
    <header>
        <h4>@T(Res.Name("Order"), 
            JDM.Int32(Model.EntityID), 
            Svc.Date((DateTime)JDM.DateTime(Model.CreatedOn)), 
            T(Res.In("API").Of("Enum").Of("OrderFlags").Name(status)))</h4>
    </header>
    <section>
        <div class="hint">
            <p>@T(Res.Name(status))</p>
        </div>
        <table class="key-value highlight-key">
            <tr>
                <td>@T(Res.Name("Seller"))</td>
                <td>
                    <a href="@Url.Action(Loc.Act("Show").Ctrl("Seller").Area("Store").Set(new
                    {
                        id = JDM.Int32(Model.Seller.EntityID)
                    }).Localized())">@JDM.String(Model.Seller.DisplayName)</a>
                    <div class="hint">
                        <p>@JDM.String(Model.SellerAddress.ShortForm)</p>
                    </div>
                </td>
            </tr>
            <tr>
                <td>@T(Res.In("Common").Of("Vocab").Name("Guid"))</td>
                <td>@JDM.String(Model.Guid)</td>
            </tr>
            <tr>
                <td>@T(Res.Name("HandlingFee"))</td>
                <td>@Svc.Price((decimal)JDM.Decimal(Model.HandlingFee))</td>
            </tr>
            <tr>
                <td>@T(Res.Name("TaxAmount"))</td>
                <td>@Svc.Price((decimal)JDM.Decimal(Model.TaxAmount))</td>
            </tr>
            <tr>
                <td>@T(Res.Name("DiscountAmount"))</td>
                <td>@Svc.Price((decimal)JDM.Decimal(Model.DiscountAmount))</td>
            </tr>
            <tr>
                <td>@T(Res.Name("Shipping"))</td>
                <td>
                    @Svc.Price((decimal)JDM.Decimal(Model.ShippingPrice))
                    <div class="hint">
                        <p>@JDM.String(Model.ShippingAddress.ShortForm)</p>
                    </div>
                </td>
            </tr>
            <tr>
                <td>@T(Res.Name("Subtotal"))</td>
                <td>@Svc.Price((decimal)JDM.Decimal(Model.Subtotal))</td>
            </tr>
            <tr>
                <td>@T(Res.Name("Total"))</td>
                <td>
                    @Svc.Price((decimal)JDM.Decimal(Model.Total))
                    <div class="hint">
                        <p>@JDM.String(Model.BillingAddress.ShortForm)</p>
                    </div>
                </td>
            </tr>
        </table>
    </section>
</div>